<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
    <title>题目列表</title>
    <link rel="stylesheet" href="/css/index.css">
    <style>
        /*设置表格格式*/
        .container .questionslist{
            padding-top: 50px;  /*内边距举例上方有50像素的差距*/
            width: 55%;  /*宽度设置800像素*/
            height: 100%;  /*高度充满*/
            margin: 0px auto;  /*上下差0像素，左右自动*/
            /* background-color: #ccc; */
            text-align: center;  /*将文字之余中间，测试只有a标签可以*/
        }
        .container .questionslist table{
            margin-top: 50px;  /*让标题和题目区别开*/
            width: 100%;
            font-size: large;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background-color: #f1fded;
        }
        .container .questionslist h1{
            color: green;
        }
        .container .questionslist table .item{
            width: 100px;
            height: 40px;
            font-size: large;
            font-family:Verdana, Geneva, Tahoma, sans-serif;
        }
        .container .questionslist table .item a{
            text-decoration: none;  /*链接下划线去掉*/
            color: black;
        }
        .container .questionslist table .item a:hover{
            /*添加鼠标事件*/
            color: blue;
            font-size: larger;
        }
        .container .footer{
            width: 100%;
            height: 50px;
            text-align: center;
            text-decoration: none;
            line-height: 50px;
            color: #ccc;
            margin-top: 15px;
        }

        /*设置难度颜色*/
        .container .questionslist table .item .color-easy{
            color: green;
        }

        .container .questionslist table .item .color-moderate{
            color: yellow;
        }

        .container .questionslist table .item .color-hard{
            color: red;
        }


    </style>
</head>
<body>
    <div class="container">
        <div class="navbar">
            <a href="/">首页</a>
            <a href="/all_questions">题库</a>
            <a href="#">讨论</a>
            <button id="loginBtn" class="login" onclick="showUserModalOrLogin()">登录</button>
        </div>

        <div class="questionslist">
            <h1>OnlineOJ列表</h1>

            <table>
                <tr>
                    <th class="item">题目编号</th>
                    <th class="item">题目标题</th>
                    <th class="item">题目难度</th>
                </tr>
                <!--循环渲染变量设定-->
                {{#question_list}}
                <tr>
                    <td class="item">{{number}}</td>
                    <td class="item"><a href="/question/{{number}}">{{title}}</a></td>
                    <td class="item">
                        <span class="{{star_color_class}}">{{star}}</span>
                    </td>
                </tr>
                {{/question_list}}
            </table>
        </div>

        <div class="footer">
            <h4>@林仔:<a href="https://blog.csdn.net/m0_69323023?type=blog">林仔的博客</a></h4>
            <h4>#项目开源:<a href="https://gitee.com/lupulin/online-judge">OnlineOJ</a></h4>
        </div>
    </div>

    <!--modal模块-->
    <div id="loginModal" class="modal">
        <div class="modal-content">
          <span class="close">&times;</span>
          <h2>登录</h2>
          <form id="loginForm">
            <input class="acc" type="text" id="username" name="username" placeholder="用户名">
            <div class="user_error">
                <pre></pre>
            </div>
            <input class="acc" type="password" id="password" name="password" placeholder="密码">
            <div class="password_error">
                <pre></pre>
            </div>
            <input class="btn" type="submit" value="登录">
            <p>没有账号？点击这里:</p>
            <button id="registerBtn">注册</button>
          </form>
        </div>
    </div>

    <div id="registerModal" class="modal">
        <div class="modal-content">
          <span class="close">&times;</span>
          <h2>注册</h2>
          <form id="registerFrom">
            <input class="acc" type="text" id="regUsername" name="regUsername" placeholder="用户名不为空">
            <div class="user_error">
                <pre></pre>
            </div>
            <input class="acc" type="password" id="regPassword" name="regPassword" placeholder="密码至少4位">
            <div class="password_error">
                <pre></pre>
            </div>
            <input class="btn" type="submit" value="注册">
          </form>
        </div>
    </div>

    <!-- 个人信息弹窗 -->
    <div id="userProfileModal" class="modal">
        <div class="modal-content">
            <span class="close">&times;</span>
            <!-- 欢迎用户 -->
            <h2 id="welcomeMsg">welcome</h2>
            <div align="center" class="img">
                <img src="oj_server/wwwroot/images/user2.jpg" alt="user2.jpg" width="157" height="165">
            </div>
            <!-- 修改密码按钮 -->
            <button id="users" onclick="changePassword()">修改密码</button>
            <!-- 退出登录按钮 -->
            <button id="users" onclick="logout()">退出登录</button>
        </div>
    </div>

    <div id="changePasswordModal" class="modal">
        <div class="modal-content">
          <span class="close">&times;</span>
          <h2>修改密码</h2>
          <canvas id="captchaCanvas" width="300" height="20"></canvas>
          <form id="changePasswordFrom">
            <input class="acc" type="text" id="verCode" name="verCode" placeholder="输入四位验证码">
            <div class="user_error">
                <pre></pre>
            </div>
            <input class="acc" type="text" id="oldPassword" name="oldPassword" placeholder="旧的密码">
            <div class="user_error">
                <pre></pre>
            </div>
            <input class="acc" type="password" id="newPassword" name="newPassword" placeholder="新的密码,密码至少4位">
            <div class="password_error">
                <pre></pre>
            </div>
            <input class="acc" type="password" id="newPassword" name="newPassword" placeholder="再次确认输入新密码">
            <div class="password_error">
                <pre></pre>
            </div>
            <input class="btn" type="submit" value="修改">
          </form>
        </div>
    </div>

    <script src="/js/login.js" type="text/javascript" charset="utf-8"></script>
    <script src="/js/question.js" type="text/javascript" charset="utf-8"></script>
</body>
</html>
